# Maintainer: Celeste <cielesti@protonmail.com>
maintainer="Celeste <cielesti@protonmail.com>"
pkgname=pict-rs
pkgver=0.5.16
pkgrel=1
pkgdesc="Simple image hosting service written in Rust"
url="https://git.asonix.dog/asonix/pict-rs"
# ppc64le, s390x: aws-lc-sys fails to build
arch="all !ppc64le !s390x"
license="AGPL-3.0-or-later"
depends="
	exiftool
	ffmpeg
	imagemagick
	"
_llvmver=18 # keep in sync with main/rust
makedepends="
	cargo
	cargo-auditable
	clang$_llvmver-libclang
	cmake
	rust-bindgen
	samurai
	"
install="$pkgname.pre-install"
pkgusers="pict-rs"
pkggroups="pict-rs"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://git.asonix.dog/asonix/pict-rs/archive/v$pkgver.tar.gz
	config-file.patch
	pict-rs.initd
	"
builddir="$srcdir/pict-rs"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/pict-rs -t "$pkgdir"/usr/bin

	install -Dm640 -g pict-rs pict-rs.toml -t "$pkgdir"/etc/pict-rs
	install -Dm755 "$srcdir"/pict-rs.initd "$pkgdir"/etc/init.d/pict-rs
}

sha512sums="
ae9c6afe0b9a955ca9db5ec3391004e88a459178a39bc5a3cedf7de8511230f2476c166f86d4a5e4a7a65eef7d39ad9862c800bcf87c7eaa316209927c6cb5c7  pict-rs-0.5.16.tar.gz
6abcd4907bfbf8857031af947cec088841e2a249a31a530678870c0da77667f05fdaa8c301bc12bf05b91a9054aea32f25cdb41be6d52f8140dc4340743d1d4c  config-file.patch
6a9d40fc5c57d35a6601118eff551b4353f0e544045b953cc2728135bdea1e1f8945ffac889d805b988af8403e0114338cde31d8d977491a63270ce97b8cae73  pict-rs.initd
"
